<?php

namespace App\Http\Controllers\View\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Facades\Services\Admin\WechatUserService;
use App\Facades\Utils\ValidateParameter;

class WechatUserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        // dd(WechatUserService::getWechatUsers()->toArray());

        return view('pages.admin.wechat_user.list',[
            'wechatUsers' => WechatUserService::getWechatUsers()
        ]);
    }

    public function detail(Request $request){

        $rules = [
            'id' => 'required|exists:wechat_users,id'
        ];

        ValidateParameter::validate($request,$rules);

        $data = $request->all();

        // dd(WechatUserService::getWechatUser($data)->toArray());

        return view('pages.admin.wechat_user.detail',[
            'wechatUser' => WechatUserService::getWechatUser($data)
        ]);
    }
}
